// 嵌套路由配置
// 实现步骤:
// 1.使用 children 属性配置路由嵌套关系
// 2.使用'<Outlet/>'组件配置二级路由渲染位置

import Login from "../page/Login";
import Article from "../page/Article";
import Layout from "../page/Layout";
import Board from "../page/Board";
import About from "../page/About";
import NotFound from "../page/NotFound";

import { createBrowserRouter } from "react-router-dom";

const router = createBrowserRouter([
  {
    path: '/',
    element: <Layout/>,
    children:[
      //设置为默认二级路由 一级路由访问的时候，它也能得到渲染
      {
        index: true,
        // path: 'board',
        element: <Board/>,
      },
      {
        path: 'about',
        element: <About/>,
      }
    ]
  },
  {
    path: '/login',
    element: <Login/>
  },
  {
    path: '/article/:id/:name',
    element: <Article/>
  },
  {
    path: "*",
    element: <NotFound/>
  }
])

export default router